<template>
  <view class="page">
    <u-navbar @leftClick="navLeftClick" :fixed="false" title="联系我们" placeholder bgColor="#fff"></u-navbar>
    <view class="content">
      <view class="u-flex u-row-between" style="margin-bottom: 56rpx;">
        <view class="u-flex">
          <image style="width: 30rpx;height: auto;margin-right: 24rpx;" src="../../static/setting/phone.png" mode="widthFix" />
          <text>客服热线</text>
        </view>
        <view style="font-size: 28rpx;color: #009FE8;text-decoration-line: underline;" @click="call">
          {{ phone }}
        </view>
      </view>
      <view class="u-flex u-row-between" style="margin-bottom: 56rpx;">
        <view class="u-flex">
          <image style="width: 34rpx;height: auto;margin-right: 24rpx;" src="../../static/setting/wechat.png" mode="widthFix" />
          <text>客服微信号</text>
        </view>
        <view style="font-size: 28rpx;color: #333333;">{{ wxcode }}</view>
      </view>
      <view class="u-text-center">
        <image style="width: 392rpx;height: 392rpx;" :src="code" />
        <view class="u-font-24" style="color: #000000;">扫一扫，可添加客服微信</view>
      </view>
    </view>
  </view>
</template>

<script>
import { getGrConfig } from '@/api/index'
import { utilWxLogin } from "@/common/util";

export default {
  data() {
    return {
      phone: '',
      wxcode: '',
      code: '',
    };
  },
  async onLoad() {
    await utilWxLogin()
    getGrConfig({deptId: uni.getStorageSync('userInfo').deptId}).then(res => {
      this.phone = res.data.customerServicePhone
      this.wxcode = res.data.wechatNumber
      this.code = res.data.wechatQrCodeUrl
    })
  },
  methods: {
    call() {
      if(this.phone) {
        uni.makePhoneCall({
          phoneNumber: this.phone //仅为示例
        });
      }
    }
  },
};
</script>

<style lang="scss" scoped>
.page {
  width: 750rpx;
  min-height: 100vh;
  background-color: #F5F5F5;
  padding-bottom: 80rpx;
  position: relative;
  .content {
    width: 702rpx;
    margin: 0 auto;
    margin-top: 12rpx;
    background: #FFFFFF;
    padding: 28rpx 32rpx;
    font-size: 28rpx;
    color: #000000;
  }
}
</style>
